<template>
  <div class="flex">
    <el-breadcrumb :separator-icon="ArrowRight">
      <el-breadcrumb-item to="/">{{ label || '首页' }}</el-breadcrumb-item>
      <template v-for="(item, index) in route.matched" :key="item.path">
        <el-breadcrumb-item
          v-if="item.meta?.label && item.meta?.breadcrumb !== false"
          :to="index !== route.matched.length - 1 ? item.path : ''">
          {{ item.meta?.label }}
        </el-breadcrumb-item>
      </template>
    </el-breadcrumb>
  </div>
</template>
<script setup lang="ts">
  import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  import { ArrowRight } from '@element-plus/icons-vue'
  import { useRoute } from 'vue-router';

  defineProps<{label?: string}>()
  const route = useRoute()
</script>